// 理解 Pick
// 而 keyof用来获取接口的属性名【key】组成的联合类型  
//  K 如果 属于 keyof T 联合类型或者它的子类型
//  那么 K extends keyof T就成立
type Pick<T, K extends keyof T> = {
  // in是类型映射,=for...in 循环迭代所有的K的类型
  [P in K]: T[P]
}


const todonew: Pick<Todo, "title"> = {
  "title": "下午3点美乐公园参加party"
}
const todonew2: Pick<Todo, "title" | "completed"> = {
  "title": "下午3点美乐公园参加party",
  "completed": false
}


interface Todo {
  title: string
  completed: boolean
  description: string
}


type TodoPreview = Pick<Todo, "title" | "completed">

const todo: TodoPreview = {
  title: 'Clean room',
  completed: false
}

const todo2: Pick<Todo, "title" | "completed"> = {
  title: 'Clean room',
  completed: false
}	
export { }	